package com.viewdraghelper;

import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Toast;

public class DummyView extends View {
    private static final String TAG = "DummyView";
    public DummyView(Context context) {
        super(context);
    }

    public DummyView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {

                Toast.makeText(v.getContext().getApplicationContext(), "clicked me!", Toast.LENGTH_SHORT).show();
            }
        });
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        if (event.getActionMasked() == MotionEvent.ACTION_CANCEL)
            Log.i(TAG, "onTouchEvent: CCCCCCCCCCCCCCCCCCCCCCCCC");
        return super.onTouchEvent(event);
    }
}
